<template>
  <a-modal v-model='showModal' @ok='confirmOk' @cancel='cancel' :title='titles' width='450px'>
    <a-spin :spinning='loading'>
      <a-form :form='form'>
        <a-row :gutter='[24, 0]'>
          <a-col :span='20'>
            <a-form-item class='mb-15' label='快递单号' :label-col='labelCol' :wrapper-col='wrapperCol'>
              <a-input
                placeholder='请输入'
                
                v-decorator="[
                  'logisticsNo',
                  {
                    rules: [{ required: true, message: '请输入' }]
                  }
                ]"
                maxLength='30'
              ></a-input>
            </a-form-item>
          </a-col>
          </a-row>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
import {deliveryOrder} from "@/api/newPet";

export default {
  	data() {
  		return {
  			loading: false,
  			details: {},
  			detailModal: false,
        showModal: false,
        titles: '发货',
        labelCol: {
          span: 8
        },
        wrapperCol: {
          span: 16
        },
        form: this.$form.createForm(this),
  		}
      
  	},
    methods: {
    	
    	open(data) {
    		this.showModal = true
    		console.log(data,'data')
    		this.details=data;
    	},
      cancel() {

        this.form.resetFields()
        this.showModal = false

      },
      confirmOk() {
        this.form.validateFields((err, values) => {
          if (!err) {
            // this.loading = true
            const { details } = this

            let data = {
              id: details && details.id ? details.id : undefined,
              ...this.$utils.trimValue(values),
              logisticsId:1
            }


            deliveryOrder(data)
              .then(() => {
                this.$message.success('操作成功')
                this.$emit('success')
                this.cancel()
              })
              .finally(() => {
                this.loading = false
              })
          }
        })
      },
    }
}
</script>

<style lang="less" scoped>
	/deep/.ant-modal-body {
		padding-left: 0;
		padding-right: 0;
	}
</style>